<template>
  <div class="qualificationTab">
    <el-table
      v-loading="loading"
      :data="tableData"
      stripe
      style="width: 100%;">
      <el-table-column
        type="index"
        label="序号"
        width="56"/>
      <el-table-column
        prop="companyName"
        label="公司名称"
        width="200"/>
      <el-table-column
        prop="companyAbb"
        label="公司简称"
        width="100"/>

      <el-table-column
        prop="relationship"
        label="关系"
        width="90"/>
      <el-table-column
        prop="level"
        label="层级"
        width="90"/>
      <el-table-column
        prop="createdTime"
        label="成立时间"
        width="150"/>
      <el-table-column
        prop="contracts"
        label="联系人"
        width="120"/>
      <el-table-column
        prop="phone"
        label="联系电话"
        width="150"/>
      <el-table-column
        prop="address"
        label="地址"
        width="200"/>
      <el-table-column
        prop="city"
        label="组织架构关联"
        width="90">
        <template slot-scope="scope">
          <el-button
            @click.native="handleConfirmed(scope.row)"
            type="text"
            size="small">待确认
          </el-button>
        </template>
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作"
        width="100">
        <template slot-scope="scope">
          <el-button
            @click="handleClick(scope.row)"
            type="text"
            size="small">审核
          </el-button>
          <el-button
            type="text"
            size="small"
            @click="update(scope.row)"
          >修改
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'QualificationTab',
  data () {
    return {
      tableData: [
        {
          id: '2e4d793bd5454db5a6477b9a053ba987',
          companyName: '国科恒泰科技有限公司',
          companyAbb: '国科恒泰',
          relationship: '集团',
          level: 6,
          createdTime: '2019-04-02',
          contracts: '张三',
          phone: '13736789873',
          address: '林和路中泰北路3a02'
        },
        {
          id: '2e4d793bd5454db5a6477b9a053ba987',
          companyName: '国科恒泰科技有限公司',
          companyAbb: '国科恒泰',
          relationship: '集团',
          level: 6,
          createdTime: '2019-04-02',
          contracts: '张三',
          phone: '13736789873',
          address: '林和路中泰北路3a02'
        },
        {
          id: '2e4d793bd5454db5a6477b9a053ba987',
          companyName: '国科恒泰科技有限公司',
          companyAbb: '国科恒泰',
          relationship: '集团',
          level: 6,
          createdTime: '2019-04-02',
          contracts: '张三',
          phone: '13736789873',
          address: '林和路中泰北路3a02'
        }
      ]
    }
  },
  props: {
    loading: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    handleConfirmed (data) {
      console.log(data)
      if (data) {
        this.$confirm('公司：国科恒泰（北京）医疗科技股份有限公司想将贵司关联到其组织架构下，请确认！', '提示', {
          type: 'warning'
        }).then(() => {
          console.log(data)
        })
      }
    },
    handleClick (data) {
      console.log(data.id)
      this.$router.push({
        path: '/basicData/enterprise/companyList/detail',
        query: {
          data: data.id
        }
      })
    },
    update (data) {
      this.$router.push({
        path: '/basicData/enterprise/companyList/update',
        query: {
          data: data.id
        }
      })
    }
  }
}
</script>

<style scoped lang="less">
    @successColor: #49C0AF;
    @stop: #AEB6C3;
    @default: #2371C5;

    .qualificationTab {
      ul,
      li {
        padding: 0;
        margin: 0;
        list-style: none;
      }
    }
</style>
